package com.kuangxiaoyang.foodapp;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListAdapter;
import android.widget.TextView;

import java.util.List;

public class CommentsAdapter extends BaseAdapter {

    private Context context;
    private List<CommentBean.DataBean> commentBeanList;

    public CommentsAdapter(Context context, List<CommentBean.DataBean> commentBeanList) {
        this.context = context;
        this.commentBeanList = commentBeanList;
    }

    @Override
    public int getCount() {
        return commentBeanList.size();
    }

    @Override
    public Object getItem(int position) {
        return commentBeanList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = View.inflate(context, R.layout.comment_item,null);

        TextView commentTv = convertView.findViewById(R.id.item_comment_tv);
        commentTv.setText(commentBeanList.get(position).getComment());

        return convertView;
    }

}